'use strict'

import HybridJS from '../core/core'

const $ = HybridJS

/**
 * 设置head背景颜色，backgroundColor颜色值如：#00ae66
 */
function setBackgroundColor(backgroundColor) {
    return $.callNativeSync("head","setBackgroundColor",{backgroundColor:backgroundColor})
}

/**
 * 设置head标题
 */
function setTitle(title) {
    return $.callNativeSync("head","setTitle",{title:title})
}

/**
 * 设置副标题
 * @param detail
 * @returns {*}
 */
function setDetail(detail) {
    return $.callNativeSync("head","setDetail", {detail:detail})
}

/**
 * 设置左边图标
 * @param url
 * @returns {*}
 */
function setLeftIcon(url) {
    return $.callNativeSync("head","setLeftIcon", {leftIcon:url})
}

/**
 * 设置右边图标
 * @param url
 * @returns {*}
 */
function setRightIcon(url) {
    return $.callNativeSync("head","setRightIcon", {rightIcon:url})
}

/**
 * 设置title图标，与上面title、detail模式不兼容
 * @param url
 * @returns {*}
 */
function setTitleIcon(url) {
    return $.callNativeSync("head","setTitleIcon", {icon:url})
}

/**
 * 设置状态栏为浅色模式，状态栏文字为黑色
 * @returns {*}
 */
function statusBarLight() {
    return $.callNativeSync("head","statusBarLight")
}

/**
 * 设置状态栏为深色模式，状态栏文字为白色
 * @returns {*}
 */
function statusBarDark() {
    return $.callNativeSync("head","statusBarDark")
}

export default {
    setBackgroundColor,
    setTitle,
    setDetail,
    setLeftIcon,
    setRightIcon,
    setTitleIcon,
    statusBarLight,
    statusBarDark
}